;========================================================================================
;	VIC-20 System Variable Equates
;	(c) 1996 Richard A. Cini, Jr. All Rights Reserved.
;
;	Portions of this have been derived from a file in comp.sys.cbm dated 9/1/94.
;	File was restructured to be used as part of an <#INCLUDE> assembler directive.
;	Undefined symbols from the comp.sys.cbm doc were created; others cleaned-up.
;	Variable locations were cross-referenced against other sources and a
;	disassembly of the KERNEL ROM for correctness.
;
;	Zero-page and Page 1 variable names partially derived from various PET books,
;	specifically for those locations that have similar functionality in both the
;	VIC and the PET. Other variable names are self-derived.
;
;
;  Release History:
;  ================
;  1996/12/13	0.10	First release to CBMAPPS (sort of public beta)
;  1996/12/19	0.12	Corrected calling tree notes on transfer vectors. Also began
;				work on system variables, and reworked KERNEL API.
;  1996/12/23	0.20	Began work on page 0 and 1 variables.
;
;========================================================================================

;========================================================================================
;  Commodore VIC-20 BASIC/KERNEL System Variable Equates
;
;  .ORG $0000		; Zero page
USRPOK =$00
USRVEC =$01
FLOATV =$03
FIXEDV =$05
SRCHCR =$07
QUOTEF =$08
TABCOL =$09
IOFLG1 =$0A
COUNT  =$0B
DIMFLG =$0C
VALTYP =$0D
INTFLG =$0E
DORES  =$0F
SUBFLG =$10
INPFLG =$11
DOMASK =$12
IOPMPT =$13
INTRVL =$14
TMSTPT =$16
LASTPT =$17
STRSTK =$19
UTLPTR =$22
ADDEND =$26
TXTTAB =$2B
VARTAB =$2D
ARYTAB =$2F
EOAPTR =$31
FRESPC =$33
UTLSTP =$35
MEMSIZ =$37
CURLIN =$39
OLDLIN =$3B
OLDTXT =$3D
DATLIN =$3F
DATPTR =$41
INPPTR =$43
VARNAM =$45
VARPNT =$47
FORPNT =$49
YSAVE  =$4B
ACCSYM =$4D
WORK1  =$4E
JMPER  =$54
WORKNV =$57
FC1EX  =$61
FC1M1  =$62
FC1M2  =$63
FC1M3  =$64
FC1M4  =$65
FC1SN  =$66
SEVALP =$67
FC1OVF =$68
FC2EX  =$69
FC2M1  =$6A
FC2M2  =$6B
FC2M3  =$6C
FC2M4  =$6D
FC2SN  =$6E
ARISGN =$6F
FC1ROU =$70
CSBFLN =$71
CHRGET =$73
CHRGOT =$7A
RNDX   =$8B
CSTAT  =$90
STPRVF =$91
TPTMCS =$92
IOFLG2 =$93
SDEFDF =$94
SDFCHR =$95
EOTFLG =$96
REGSAV =$97
COPNFL =$98
INDEV  =$99
OUTTEV =$9A
TPCPAR =$9B
BYTINF =$9C
CMDMOD =$9D
TP1ERC =$9E
TP2ERC =$9F
CTIMR0 =$A0
CTIMR1 =$A1
CTIMR2 =$A2
SBITCF =$A3
CYCLE  =$A4
CNTDN  =$A5
CSBFPT =$A6
TPLEAD =$A7
TPWRRE =$A8
TPWSRE =$A9
TPSCAN =$AA
TPWLRC =$AB
CSBPTR =$AC
TPEEOP =$AE
TPCON1 =$B0
TPCON2 =$B1
CBSTPT =$B2
TPTIMR =$B4
TAPEOT =$B5
RDCHAR =$B6
FNMLEN =$B7
LOGFIL =$B8
SECADR =$B9
CHANNL =$BA
FNPTR  =$BB
WSWRIC =$BD
CBLKRW =$BE
SWDBUF =$BF
TPMOTR =$C0
IOSTRT =$C1
KENTER =$C3
CURKEY =$C5
KEYCNT =$C6
SCRVFL =$C7
EOLPTR =$C8
ICRROW =$C9
KEYDN  =$CB
CENABF =$CC
CRSTIM =$CD
CRUNDR =$CE
CRBLNK =$CF
INSRC  =$D0
LINPTR =$D1
CSRIDX =$D3
CSRMOD =$D4
LINLEN =$D5
CURROW =$D6
LASTKY =$D7
INSRTO =$D8
SLLTBL =$D9
SLDMY  =$F1
SCROWM =$F2
COLRPT =$F3
KBDPTR =$F5
RXPTR  =$F7
TXPTR  =$F9
OSFRE0 =$FB
OSFRE1 =$FC
OSFRE2 =$FD
OSFRE3 =$FE
BASSTO =$FF

;
;  .ORG $0100		;Page 1 Variables
FBUFFR =$0100

;
;  .ORG $0200		;Page 2 Variables
BUF    =$0200
FILTBL =$0259
DEVTBL =$0263
SECATB =$026D
KBUFFR =$0277
OSSTAR =$0281
OSTOP  =$0283
STIMOT =$0285
CLCODE =$0286
CSRCLR =$0287
SCNMPG =$0288
KBMAXL =$0289
KEYRPT =$028A
KRPTSP =$028B
KRPTDL =$028C
SHFTFL =$028D
LSSHFT =$028E
FCEVAL =$028F
SHMODE =$0291
SCRLFL =$0292
SRCTRG =$0293
SRCMDR =$0294
SBTIM  =$0295
SRSTAT =$0297
BITSTS =$0298
BAUDRT =$0299
RXPTR1 =$029B
RXINPT =$029C
TXPTR1 =$029D
TXOUTP =$029E
TAPIRQ =$029F
PGINDR =$02A1

;
;  .ORG $0300		;Page 3 Variables
NERRPT =$0300
NMAIN  =$0302
NCRNCH =$0304
NLIST  =$0306
NBYEBY =$0308
NEVAL  =$030A
6502A  =$030C
6502X  =$030D
6502Y  =$030E
6502P  =$030F
UNKNO1 =$0310
UNKNO2 =$0334
CSBUF  =$033C

;
;  .ORG $9000		; VIC PAGE
;
;  Locations commented-out are not referenced in the V2.0 KERNEL ROM.
;
;HCENTR =$9000
;VCENTR =$9001
VRCURS =$9002
VRROWS =$9003
;RASTER =$9004
VRSTRT =$9005
;LPENH  =$9006
;LPENV  =$9007
;PDLX   =$9008
;PDLY   =$9009
;OSC1    =$900A
;OSC2    =$900B
;OSC3    =$900C
;OSC4    =$900D
;VOLUME  =$900E
;COLRRG  =$900F

;
;  .ORG $9110		I/O Page
;  VIA #1
D1ORB  =$9110
D1ORA  =$9111
D1DDRB =$9112
D1DDRA =$9113
D1TM1L =$9114
D1TM1H =$9115
D1T1CL =$9116
D1T1CH =$9117
D1TM2L =$9118
D1TM2H =$9119
D1SHFR =$911A
D1ACR  =$911B
D1PCR  =$911C
D1IFR  =$911D
D1IER  =$911E
D1ORAH =$911F		;Cassette switch sense
;
;
;  VIA #2
D2ORB  =$9120
D2ORA  =$9121
D2DDRB =$9122
D2DDRA =$9123
D2TM1L =$9124
D2TM1H =$9125
D2T1CL =$9126
D2T1CH =$9127
D2TM2L =$9128
D2TM2H =$9129
D2SHFR =$912A
D2ACR  =$912B
D2PCR  =$912C
D2IFR  =$912D
D2IER  =$912E
D2ORAH =$912F

CLRAM1 =$9400		;Alternate Color RAM location
CLRAM  =$9600		;Color RAM 
A0BASE =$A000		;Autostart ROM base

;========================================================================================
;  Commodore Public Kernel API
;
ACPTR  =$FFA5		;Receive From Serial Bus
BREAK  =$FED2		;Break vector handler
CHKIN  =$FFC6		;Set Input Device
CHKOUT =$FFC9		;Set Output Device
CHRIN  =$FFCF		;Input a byte
CHROUT =$FFD2		;Output One Character
CIOUT  =$FFA8		;Send Serial Deferred
CLALL  =$FFE7		;Abort All Files
CLOSE  =$FFC3		;Close File
CLRCHN =$FFCC		;Restore Default I/O
GETIN  =$FFE4		;Get a byte
IOBASE =$FFF3		;Return I/O Base Address
LISTN  =$FFB1		;Send LISTEN Command on Serial Bus	
LOAD   =$FFD5		;Load RAM From Device (flows to ILINKL)
MEMBOT =$FF9C		;Set / Read Bottom of Memory
MEMTOP =$FF99		;Set / Read Top of Memory
OPEN   =$FFC0		;Open File
PLOT   =$FFF0
RDTIM  =$FFDE		;Read Real-Time Clock
READST =$FFB7		;Get I/O Status Word
RESTOR =$FF8A		;Restore Kernel Vectors (at $0314)
SAVE   =$FFD8		;Save RAM To Device (flows to ILINKS)
SCNKEY =$FF9F		;Scan keyboard
SCREEN =$FFED
SECND  =$FF93		;Send LISTEN Secondary Address
SETLFS =$FFBA		;Set Logical File Parameters
SETMSG =$FF90		;Control OS Messages
SETNAM =$FFBD		;Set Filename
SETTIM =$FFDB		;Set Real-Time Clock
SETTMO =$FFA2		;Set IEEE Timeout
STOP   =$FFE1		;Check STOP Key
TALK   =$FFB4		;Send TALK Command on Serial Bus	
TKSA   =$FF96		;Send TALK Secondary Address
UDTIM  =$FFEA		;Increment Real-Time Clock
UNLSN  =$FFAE		;Send UNLISTEN on Serial Bus
UNTLK  =$FFAB		;Send UNTALK on Serial Bus
USER   =$FED2		;User vector
VECTOR =$FF8D		;Change Vectors For User


;========================================================================================
;  Transfer Vectors
;
;  Generally, these are not meant to be called by USER programs, 
;  except maybe IRQ, which can be called to chain interrupts.
NMI    =$FEA9		; FFFA =>FEA9=>(0318)=>FEAD
RESET  =$FD22		; FFFC =>FD22
IRQ    =$FF72		; FFFE =>FF72=>(0314)=>EABF
		;		 =>(0316)=>FED2=>(C002)

;========================================================================================
;  System Vectors
;
;  These are the indirected system vectors located in page 1 RAM. Calling these
;  functions requires an indirect JSR. These locations used primarily for
;  re-vectoring to user-created code that provides equivalent functionality.
IRQVP  =$0314		;IRQ			EABF
BRKVP  =$0316		;Break		FED2
NMIVP  =$0318		;NMI			FEAD
OPENVP =$031A		;OPEN			F40A
CLOSVP =$031C		;CLOSE		F34A
CKINVP =$031E		;Set Input		F2C7
CKOTVP =$0320		;Set Output		F309
CLCHVP =$0322		;Restore I/O	F3F3
CHINVP =$0324		;INPUT		F20E
CHOTVP =$0326		;OUTPUT		F27A
STOPVP =$0328		;STOP			F770
GTINVP =$032A		;GET			F1F5
CLALVP =$032C		;Abort I/O		F3EF
USERVP =$032E		;User			FED2
LLODVP =$0330		;Link to Load	F549
LSAVVP =$0332		;Link to Save	F685


;========================================================================================
;  Commodore BASIC ROM API
;
;
BENTER =$c000		;Basic Restart Vectors
BPANIC =$c002		;Basic PANIC entry
BASSIG =$c004		;'cbmbasic'
STMDSP =$c00c		;BASIC Command Vectors
FUNDSP =$c052		;BASIC Function Vectors
OPTAB  =$c080		;BASIC Operator Vectors
RESLST =$c09e		;BASIC Command Keyword Table
MSCLST =$c129		;BASIC Misc. Keyword Table
OPLIST =$c140		;BASIC Operator Keyword Table
FUNLST =$c14d		;BASIC Function Keyword Table
ERRTAB =$c19e		;Error Message Table
ERRPTR =$c328		;Error Message Pointers
OKK    =$c364		;Misc. Messages
			;c364	;'<cr>ok<cr>'
			;c369	;'error'
UNUSE1 =$c389		;Unused byte
FNDFOR =$c38a		;Find FOR/GOSUB Entry on Stack
BLTU   =$c3b8		;Open Space in Memory
GETSTK =$c3fb		;Check Stack Depth
REASON =$c408		;Check Memory Overlap
OMERR  =$c435		;Output "?OUT OF MEMORY Error"
ERROR  =$c437		;Error Routine
ERRFIN =$c469		;Break Entry
READY  =$c474		;BASIC ready entry
MAIN   =$c480		;Input & Identify BASIC Line
MAIN1  =$c49c		;Get Line Number & Tokenise Text
INSLIN =$c4a2		;Insert BASIC Text
LNKPRG =$c533		;Rechain Lines
INLIN  =$c560		;Input Line Into Buffer
CRUNCH =$c579		;Tokenize Input Buffer
FNDLIN =$c613		;Search for Line Number
SCRTCH =$c642		;Perform [new]
CLEAR  =$c65e		;Perform [clr]
STXPT  =$c68e		;Reset TXTPTR
LIST   =$c69c		;Perform [list]
QPLOP  =$c717		;Handle LIST 
FOR    =$c742		;Perform [for]
NEWSTT =$c7ae		;BASIC Warm Start
CKEOL  =$c7c4		;Check End of Program
GONE   =$c7e1		;Prepare to execute statement
GONE3  =$c7ed		;Perform BASIC Keyword
RESTOR =$c81d		;Perform [restore]
STOP   =$c82c		;Perform [stop], [end], break
CONT   =$c857		;Perform [cont]
RUN    =$c871		;Perform [run]
GOSUB  =$c883		;Perform [gosub]
GOTO   =$c8a0		;Perform [goto]
RETURN =$c8d2		;Perform [return]
DATA   =$c8f8		;Perform [data]
DATAN  =$c906		;Search for Next Statement / Line
IF     =$c928		;Perform [if]
REM    =$c93b		;Perform [rem]
ONGOTO =$c94b		;Perform [on]
LINGET =$c96b		;Fetch linnum From BASIC
LET    =$c9a5		;Perform [let]
PUTINT =$c9c4		;Assign Integer
PTFLPT =$c9d6		;Assign Floating Point
PUTSTR =$c9d9		;Assign String
PUTTIM =$c9e3		;Assign TI$
GETSPT =$ca2c		;Add Digit to FAC#1
PRINTN =$ca80		;Perform [print#]
CMD    =$ca86		;Perform [cmd]
STRDON =$ca9a		;Print String From Memory
PRINT  =$caa0		;Perform [print]
VAROP  =$cab8		;Output Variable	
CRDO   =$cad7		;Output CR/LF	
COMPRT =$cae8		;Handle comma, TAB(, SPC(
STROUT =$cb1e		;Output String	
OUTSPC =$cb3b		;Output Format Character	
DOAGIN =$cb4d		;Handle Bad Data	
GET    =$cb7b		;Perform [get]	
INPUTN =$cba5		;Perform [input#]	
INPUT  =$cbbf		;Perform [input]	
BUFFUL =$cbea		;Read Input Buffer	
QINLIN =$cbf9		;Do Input Prompt	
READ   =$cc06		;Perform [read]	
RDGET  =$cc35		;General Purpose Read Routine	
EXINT  =$ccfc		;Input Error Messages
			;ccfc	'?EXTRA IGNORED<CR>'	
			;cd0c	'?REDO FROM START<CR>'	
NEXT   =$cd1e		;Perform [next]
DONEXT =$cd61		;Check Valid Loop
FRMNUM =$cd8a		;Confirm Result
FRMEVL =$cd9e		;Evaluate Expression in Text
EVAL   =$ce83		;Evaluate Single Term
PIVAL  =$cea8		;Constant - pi
QDOT   =$cead		;Continue Expression
PARCHK =$cef1		;Expression in Brackets
CHKCLS =$cef7		;Confirm Character
CHKPNC =$cef7		;test ')'
CHKPNO =$cefa		;test '('
CHKCOM =$cefd		;test comma
SNERR  =$cf08		;Output "?SYNTAX Error"
DOMIN  =$cf0d		;Set up NOT Function
RSVVAR =$cf14		;Identify Reserved Variable
ISVAR  =$cf28		;Search for Variable	
TISASC =$cf48		;Convert TI to ASCII String	
ISFUN  =$cfa7		;Identify Function Type	
STRFUN =$cfb1		;Evaluate String Function	
NUMFUN =$cfd1		;Evaluate Numeric Function	
OROP   =$cfe6		;Perform [or], [and]"	
DOREL  =$d016		;Perform <, =, >	
NUMREL =$d01b		;Numeric Comparison	
STRREL =$d02e		;String Comparison	
DIM    =$d07e		;Perform [dim]	
PTRGET =$d08b		;Identify Variable	
ORDVAR =$d0e7		;Locate Ordinary Variable	
NOTFNS =$d11d		;Create New Variable	
NOTEVL =$d128		;Create Variable	
ARYGET =$d194		;Allocate Array Pointer Space	
N32768 =$d1a5		;Constant 32768 in Flpt	DATA
FACINX =$d1aa		;FAC#1 to Integer in (AC/YR)
INTIDX =$d1b2		;Evaluate Text for Integer
AYINT  =$d1bf		;FAC#1 to Positive Integer
ISARY  =$d1d1		;Get Array Parameters
FNDARY =$d218		;Find Array
BSERR  =$d245		;"?Bad subscript error"
FCERR  =$d248		;"?Illegal quantity error"
NOTFDD =$d261		;Create Array
INLPN2 =$d30e		;Locate Element in Array
UMULT  =$d34c		;Number of Bytes in Subscript
FRE    =$d37d		;Perform [fre]
GIVAYF =$d391		;Convert Integer in (AC/YR) to Flpt
POS    =$d39e		;Perform [pos]
ERRDIR =$d3a6		;Confirm Program Mode
GETFNM =$d3e1		;Check Syntax of FN
FNDOER =$d3f4		;Perform [fn]
STRD   =$d465		;Perform [str$]
STRLIT =$d487		;Setup String
PUTNW1 =$d4d5		;Save String Descriptor
GETSPA =$d4f4		;Allocate Space for String
GARBAG =$d526		;Garbage Collection
DVARS  =$d5bd		;Search for Next String
GRBPAS =$d606		;Collect a String
CAT    =$d63d		;Concatenate Two Strings
MOVINS =$d67a		;Store String in High RAM
FRESTR =$d6a3		;Perform String Housekeeping
FREFAC =$d6db		;Clean Descriptor Stack
CHRD   =$d6ec		;Perform [chr$]
LEFTD  =$d700		;Perform [left$]
RIGHTD =$d72c		;Perform [right$]
MIDD   =$d737		;Perform [mid$]
PREAM  =$d761		;Pull sTring Parameters
LEN    =$d77c		;Perform [len]
LEN1   =$d782		;Exit String Mode
ASC    =$d78b		;Perform [asc]
GTBYTC =$d79b		;Evaluate Text to 1 Byte in XR
VAL    =$d7ad		;Perform [val]
STRVAL =$d7b5		;Convert ASCII String to Flpt
GETNUM =$d7eb		;Get parameters for POKE/WAIT
GETADR =$d7f7		;Convert FAC#1 to Integer in LINNUM
PEEK   =$d80d		;Perform [peek]
POKE   =$d824		;Perform [poke]
WAIT   =$d82d		;Perform [wait]
FADDH  =$d849		;Add 0.5 to FAC#1
FSUB   =$d850		;Perform Subtraction
FADD5  =$d862		;Normalize Addition
FADD   =$d867		;Perform Addition
NEGFAC =$d947		;2's Complement FAC#1
OVERR  =$d97e		;"?OVERFLOW Error"
MULSHF =$d983		;Multiply by Zero Byte
FONE   =$d9bc		;Table of Flpt Constants
LOG    =$d9ea		;Perform [log]
FMULT  =$da28		;Perform Multiply
MULPLY =$da59		;Multiply by a Byte
CONUPK =$da8c		;Load FAC#2 From Memory
MULDIV =$dab7		;Test Both Accumulators
MLDVEX =$dad4		;Overflow / Underflow
MUL10  =$dae2		;Multiply FAC#1 by 10
TENC   =$daf9		;Constant 10 in Flpt
DIV10  =$dafe		;Divide FAC#1 by 10
FDIV   =$db07		;Divide FAC#2 by Flpt at (AC/YR)
FDIVT  =$db0f		;Divide FAC#2 by FAC#1
MOVFM  =$dba2		;Load FAC#1 From Memory
MOV2F  =$dbc7		;Store FAC#1 in Memory
MOVFA  =$dbfc		;Copy FAC#2 into FAC#1	
MOVAF  =$dc0c		;Copy FAC#1 into FAC#2	
ROUND  =$dc1b		;Round FAC#1	
SIGN   =$dc2b		;Check Sign of FAC#1	
SGN    =$dc39		;Perform [sgn]	
ABS    =$dc58		;Perform [abs]	
FCOMP  =$dc5b		;Compare FAC#1 With Memory	
QINT   =$dc9b		;Convert FAC#1 to Integer	
INT    =$dccc		;Perform [int]	
FIN    =$dcf3		;Convert ASCII String to a Number in FAC#1	
N0999  =$ddb3		;String Conversion Constants
INPRT  =$ddc2		;Output 'IN ' + Line Number	
FOUT   =$dddd		;Convert FAC#1 to ASCII String	
FOUTIM =$de68		;Convert TI to String	
FHALF  =$df11		;Table of Constants	
SQR    =$df71		;Perform [sqr]	
FPWRT  =$df7b		;Perform power ($)
NEGOP  =$dfb4		;Negate FAC#1
LOGEB2 =$dfbf		;Table of Constants
EXP    =$dfed		;Perform [exp]


;========================================================================================
;  Commodore Internal Kernel API
;
;  Code continues across segment boundary from Basic ROM
;	
POLYX  =$e040		;Series Evaluation
RMULC  =$e08a		;Constants for RND
RND    =$e094		;Perform [rnd]
BIOERR =$e0f6		;Handle I/O Error in BASIC
BCHOUT =$e109		;Output Character
BCHIN  =$e10f		;Input Character
BCKOUT =$e115		;Setup For Output
BCKIN  =$e11b		;Setup For Input
BGETIN =$e121		;Get One Character
SYS    =$e127		;Perform [sys]
SAVET  =$e153		;Perform [save]
VERFYT =$e162		;Perform [verify / load]
OPENT  =$e1bb		;Perform [open]
CLOSET =$e1c4		;Perform [close]
SLPARA =$e1d1		;Get Parameters For LOAD/SAVE
COMBYT =$e1fd		;Get Next One Byte Parameter
DEFLT  =$e203		;Check Default Parameters
COMMA  =$e20b		;Check For Comma
OCPARA =$e216		;Get Parameters For OPEN/CLOSE
COS    =$e261		;Perform [cos]
SIN    =$e268		;Perform [sin]
TAN    =$e2b1		;Perform [tan]
PI2    =$e2dd		;Table of Trig Constants
			;e2dd	pi/2   1.570796327
			;e2e2	pi*2   6.28318531
			;e2e7	0.25
			;e2ec	#05(counter)
			;e2ed	-14.3813907
			;e2f2	42.0077971
			;e2f7	-76.7041703
			;e2fc	81.6052237
			;e301	-41.3417021
			;e306	6.28318531
ATN    =$e30b		;Perform [atn]
ATNCON =$e33b		;Table of ATN Constants
			;e33b	#0B(counter)
			;e3ec	-0.000684794
			;e341	0.004850942
			;e346	-0.161117018
			;e34b	0.034209638
			;e350	-0.054279133
			;e355	0.072457197
			;e35a	-0.089802395
			;e35f	0.110932413
			;e364	-0.142839808
			;e369	0.19999912
			;e36e	-0.333333316
			;e373	1
INIT   =$e378		;BASIC Cold Start
INITAT =$e387		;CHRGET For Zero-page
RNDSED =$e39f		;RND Seed For zero-page (0.811635157)
INITCZ =$e3a4		;Initialize BASIC RAM
INITMS =$e404		;Output Power-Up Message
FREMES =$e429		;Power-up message ' BYTES FREE<CR>'
WORDS  =$e436		;Power-up message '<CLR>**** CBM BASIC V2 ****<CR>'
BVTRS  =$e44f		;Table of BASIC Vectors (for 0300)
INITV  =$e45b		;Initialize Vectors
BASSFT =$e467		;BASIC Warm Restart [RUN/STOP-RESTORE]
UNKNO3 =$e475		;UNKNOWN
UNUSD2 =$e47c		;Unused Bytes For Future Patches
SOUT1  =$e4a0		;Serial Output 1
SOUT0  =$e4a9		;Serial Output 0
SDCLK  =$e4b2		;Get Serial Data And Clock In
SSADR  =$e4bc		;Get Secondary Address patch for Serial LOAD/VERIFY
SLDPCH =$e4c1		;Relocated Load patch for Serial LOAD/VERIFY
TPWPCH =$e4cf		;Tape Write patch for CLOSE
UNUSD3 =$e4da		;Unused	
SCREEN =$e505		;Return Screen Organization
PLOT   =$e50a		;Read / Set Cursor X/Y Position
CINT1  =$e518		;Initialize I/O
CLRSCN =$e55f		;Clear Screen
HOME   =$e581		;Home Cursor
SCNPTR =$e587		;Set Screen Pointers
PANIC  =$e5b5		;Set I/O Defaults 
IODEF1 =$e5bb		;Set I/O Defaults (unused)
LP2    =$e5cf		;Get Character From Keyboard Buffer
INKEY  =$e5e5		;Input From Keyboard
INSCRN =$e64f		;Input From Screen or Keyboard
QUOTET =$e6b8		;Quotes Test
CMD4   =$e6c5		;Set Up Screen Print
CSRPLS =$e6ea		;Advance Cursor
CSRMIN =$e719		;Retreat Cursor
CSRUP  =$e72d		;Back on to Previous Line
OUTSCR =$e742		;Output to Screen
NOSHCH =$e756		;-unshifted characters-
SHCHRS =$e800		;-shifted characters-
NEWLIN =$e8c3		;Go to Next Line
CR     =$e8d8		;Output <CR>
CKLNMI =$e8e8		;Check Line Decrement
CKLNPL =$e8fa		;Check Line Increment
STCLRC =$e912		;Set Color Code
COLRTB =$e921		;Color Code Table
XLATB1 =$e929		;Screen code table
SCRLSC =$e975		;Scroll Screen
INSSPC =$e9ee		;Open a Space On The Screen
MOVELN =$ea56		;Move a Screen Line
COPYCL =$ea6e		;Syncronize Color Transfer
LINSTR =$ea7e		;Set Start of Line
CLRLIN =$ea8d		;Clear Screen Line
PRNSCR =$eaa1		;Print To Screen
BLINK  =$eab2		;Blink cursor 
IRQVEC =$eabf		;Main IRQ Entry Point
SCNKEY =$eb1e		;Scan Keyboard
PROCKY =$eb74		;Process Key Image
KDECOD =$ec46		;Pointers to Keyboard decoding tables	
KDECD1 =$ec5e		;Keyboard Decoding Table-Unshifted
KDECD2 =$ec9f		;Keyboard Decoding Table-Shifted
KDECD3 =$ece0		;Keyboard Decoding Table-Commodore	
GRTXTF =$ed21		;Graphics/Text Control
KDECD4 =$ed69		;Keyboard Decoding Table	
KDECD5 =$eda3		;Keyboard Decoding Table-Control
VICSUP =$ede4		;Video Chip Set Up Table	
RUNSHF =$edf4		;Shift-Run Equivalent	
LBSCAD =$edfd		;Low Byte Screen Line Addresses
ITALK  =$ee14
ILISTN =$ee16
OTDSBU =$ee49		;Send Data On Serial Bus	
FLGERR =$eeb4		;Flag Errors	
			;eeb4  STATUS #80 - DEVICE NOT PRESENT
			;eeb7	 STATUS #03 - WRITE TIMEOUT
ISECND =$eec0
CLRATN =$eec5		;Clear ATN
ITKSA  =$eece
WTFCLK =$eed3		;Wait For Serial Clock
ICIOUT =$eee4
IUNTLK =$eef6
IUNLSN =$ef04
IACPTR =$ef19
SCLK1  =$ef84		;Serial Clock On
SCLK0  =$ef8d		;Serial Clock Off
DELAY  =$ef96		;Delay 1 ms
SSEND  =$efa3		;RS-232 Send
SSNDN  =$efee		;Send New RS-232 Byte
DSRERR =$f016		;'No DSR' Error	
CTSERR =$f019		;'No CTS' Error	
DISTIM =$f021		;Disable Timer	
BITCNT =$f027		;Compute Bit Count	
SERRX  =$f036		;RS-232 Receive	
RXSET  =$f05b		;Setup To Receive	
PROCSB =$f068		;Process RS-232 Byte	
SSUBBT =$f0bc		;Submit to RS-232	
SSENDB =$f0ed		;Send to RS-232 Buffer	
SERINP =$f116		;Input From RS-232	
SERGET =$f14f		;Get From RS-232	
SBIDLE =$f160		;Serial Bus Idle	
KIOMSG =$f174		;Table of Kernel I/O Messages
			;f174	'<CR> I/O ERROR #'	
			;f1df	'OK<CR>'
DIRMSG =$f1e2		;Print Message if Direct
MSG    =$f1e6		;Print Message
IGETIN =$f1f5
ICHRIN =$f20e
GTTSCH =$f250
ICHROT =$f27a
ICHKIN =$f2c7
ICHKOT =$f309
ICLOSE =$f34a		;Get From Tape / Serial / RS-232
FIND   =$f3cf		;Find File
FLATRB =$f3df		;Set File values
ICLALL =$f3ef
ICLRCH =$f3f3
IOPEN  =$f40a
SENDSA =$f495		;Send Secondary Address
SEROPN =$f4c7		;Open RS-232
ILOAD  =$f542
LNKLOD =$f549		;-load-
SERLOA =$f55c		;Load File From Serial Bus
TAPLOA =$f5ca		;Load File From Tape
SRCHMS =$f647		;Print "SEARCHING"
FLNMMS =$f659		;Print Filename
LOADMS =$f66a		;Print "LOADING / VERIFYING"
LNKSAV =$f685		;-save-
SERSAV =$f692		;Save to Serial Bus
TAPESV =$f6f1		;Save to Tape
SAVEMS =$f728		;Print "SAVING"
IUDTIM =$f734
IRDTIM =$f760
ISETTM =$f767
ISTOP  =$f770
IOERMS =$f77e		;Output I/O Error Messages
			;f77e	'TOO MANY FILES'
			;f781	'FILE OPEN'
			;f784	'FILE NOT OPEN'
			;f787	'FILE NOT FOUND'
			;f78a	'DEVICE NOT PRESENT'
			;f78d	'NOT INPUT FILE'
			;f790	'NOT OUTPUT FILE'
			;f793	'MISSING FILENAME'
			;f796	'ILLEGAL DEVICE NUMBER'
LOCTPH =$f7af		;Find Any Tape Header
WRTPHD =$f7e7		;Write Tape Header
GETBFA =$f84d		;Get Buffer Address
SETBST =$f854		;Set Buffer Stat / End Pointers
LOCSPH =$f867		;Find Specific Tape Header
INCTPT =$f88a		;Bump Tape Pointer
PLAYMS =$f894		;"Print "PRESS PLAY ON TAPE"
TPSTAT =$f8ab		;Check Tape Status
RECDMS =$f8b7		;Print "PRESS RECORD..."
TPREAD =$f8c0		;Initiate Tape Read
TPWRIT =$f8e3		;Initiate Tape Write
TPCODE =$f8ef		;Common Tape Code
TPSTOP =$f94b		;Check Tape Stop
SETRDT =$f95d		;Set Read Timing
RDTPBT =$f98e		;Read Tape Bits
STORTC =$faad		;Store Tape Characters
RSTTPP =$fbd2		;Reset Tape Pointer
NCHAR  =$fbdb		;New Character Setup
TONE   =$fbea		;Send Tone to Tape
TWRDTA =$fc06		;Write Data to Tape
WRLEDR =$fc95		;Write Tape Leader
RESIRQ =$fccf		;Restore Normal IRQ
STOIRQ =$fcf6		;Set IRQ Vector
NOMOTR =$fd08		;Kill Tape Motor
CKWRPT =$fd11		;Check Read / Write Pointer
INCRDP =$fd1b		;Bump Read / Write Pointer
SCNROM =$fd3f		;Check For A000 ROM
ROMSIG =$fd4d		;Autostart ROM signature 'a0CBM'
IRESTR =$fd52
IVECTR =$fd57
KNRLSV =$fd6d		;Kernel reset vector table
RAMTAS =$fd8d		;Initialize System Constants
TAPEVC =$fdf1		;IRQ vector table for tape I/O
IOINIT =$fdf9		;Initialize I/O
ENABTM =$fe39		;Enable Timer
ISETNM =$fe49
ISETLF =$fe50
IRDST  =$fe57
ISETMS =$fe66
ISETTO =$fe6f
IMEMTP =$fe73
IMEMBT =$fe82
MEMTST =$fe91		;Test system memory
NMIXFR =$fea9		;NMI Transfer Entry
WARMST =$fed2		;Warm Start Basic [BRK]
EOI    =$ff56		;Exit Interrupt
232TBL =$ff5c		;RS-232 Timing Table
IRQXFR =$ff72		;IRQ Transfer Entry

VIC-20 System Variable Equates	Page 6
12/24/96 10:32 AM



